<template>
	<div>
		<div class="top-bar">
			<div class="back" @click="backRoute" ><van-icon name="arrow-left" class="icon"/></div>
			<div class="top-bar-title">{{title}}</div>
			<div style="flex: 1;">
				<slot name="rightItem"></slot>
			</div>
		</div>
		<div class="seat" ref="seat1"></div>
	</div>
</template>

<script>
	import envUrl from '@assets/js/env3.js'
	export default{
		props:['title','open'],
		mounted() {
			this.$store.commit('setDomHeight', this.$refs.seat1.offsetHeight)
		},
		methods:{
			backRoute(){
				if(this.open === '1'){
					this.$emit('closeText')	
				}else if(this.open === '2'){
					localStorage.clear()
					jme.browser.closeWeb();
				}else if(this.open === '3'){
					this.$emit('closeAddTable')
				}else if(this.open === '4'){
					this.$router.push('/applyuser/complete')
				}else{					
					this.$router.go(-1);//返回上一层
				}				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top-bar{
		height: 80px;
		line-height: 112px;
		width: 100vw;
		position: fixed;
		top: 0;
		left: 0;
		// border-bottom: 1px solid #C8C9CC;
		background-color: $bg-1;
		z-index: 4;
		box-shadow:0 1px 3px rgba(0,0,0,.1);
		display: flex;
	}
	.back{
		flex: 1;
	}
	.top-bar-title{
		text-align: center;
		font-weight: 550;
		font-size: vw(17);
		font-weight: 550;
		color: $color1;
		flex: 2;
		overflow: hidden;
	}
	.icon{
		font-size: vw(24);
		line-height: vw(112);
		margin-left: vw(7);
	}
	.seat{
		width: 100vw;
		height: 80px;
		background-color: #FFFFFF;
	}
</style>
